import React from "react";
import { RouterRowState } from "../types";
import { HomeO, NotesO, CartO, UserCircleO } from "@react-vant/icons";

const Car = React.lazy(() => import("../views/car"));
const Classify = React.lazy(() => import("../views/classify"));
const Home = React.lazy(() => import("../views/home"));
const My = React.lazy(() => import("../views/my"));
const MainLayout = React.lazy(() => import("../views/mainLayout"));

const Detail = React.lazy(() => import("../views/detail"));
const Login = React.lazy(() => import("../views/login"));
const Search = React.lazy(() => import("../views/search"));
const Order = React.lazy(() => import("../views/order"));
const PayResult = React.lazy(() => import("../views/payResult"));

export const ROUTES_LIST_CHILDREN: RouterRowState[] = [
  { path: "/", element: <Home></Home>, title: "首页", icon: <HomeO /> },
  {
    path: "/classify",
    element: <Classify></Classify>,
    title: "分类",
    icon: <NotesO />,
  },
  { path: "/car", element: <Car></Car>, title: "购物车", icon: <CartO /> },
  { path: "/my", element: <My></My>, title: "我的", icon: <UserCircleO /> },
];

export const ROUTES_LIST: RouterRowState[] = [
  {
    path: "/",
    element: <MainLayout></MainLayout>,
    children: ROUTES_LIST_CHILDREN,
    title: "布局",
  },
  {
    path: "/detail/:id",
    element: <Detail></Detail>,
    title: "详情",
  },
  {
    path: "/login",
    element: <Login></Login>,
    title: "登录",
  },
  {
    path: "/search",
    element: <Search></Search>,
    title: "搜索",
  },
  {
    path: "/order",
    element: <Order></Order>,
    title: '订单',
    authLogin: true
  },
  {
    path: "/pay/result",
    element: <PayResult></PayResult>,
    title: '支付结果',
  },
];
